#include <iostream>
#include <vector>


template <typename T> 
void move_max(T begin, T end) {
    if (begin == end) {
        return;
    }
    T maximum_position = begin;
    for (auto it = begin; it!= end; ++it) {
        if (*maximum_position < *it) {
            maximum_position = it;
        }
    }
    std::iter_swap(maximum_position, end - 1);
}

template <typename T> 
void read_array(std::vector <T>* input_array) {
    int n;
    std::cin >> n;
    input_array->reserve(n);
    for (int i = 0; i < n; ++i) {
        T number; std::cin >> number;
        input_array->push_back(number);
    }
}

template <typename T> 
void choosing_sort(T begin, T end) {
    for (auto it = end; it != begin; --it) {
        move_max(begin, it);
    }
}

int main() {
    std::vector <int> input_array;
    read_array(&input_array);
    choosing_sort(input_array.begin(), input_array.end());
    for (auto el : input_array) {
        std::cout << el << " ";
    }
}
